<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var myDate = new Date();
        var date;
        date = myDate.getHours();
        exp = Math.floor(date / 6);
        switch (exp) {
            case 0:
                alert('凌晨好');
                break;
            case 1:
                alert('早上好');
                break;
            case 2:
                alert('下午好');
                break;
            case 3:
                alert('晚上好');
                break;
        }
    </script>
</head>

<body>

</body>

</html>